﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLL;
using DAL;
using System.Configuration;
using EntityFramework;

namespace Factory
{
    public class AuthorityManageFactory
    {
        //public static IAuthorityRepository InitializeAuthorityRepository()
        //{
        //    return new AuthorityManage();
        //}
        public static IAuthorityRepository InitializeAuthorityRepository()
        {
            string dataGetWay = System.Configuration.ConfigurationManager.AppSettings["DAL"];

            if (dataGetWay == "ADO.NET")
            {
                IAuthorityRepository authorityRepository = (IAuthorityRepository)new DAL.AuthorityManage();
                return authorityRepository;
            }

            else if (dataGetWay == "EF")
            {

                IAuthorityRepository authorityRepository = (IAuthorityRepository)new EntityFramework.AuthorityManage();
                return authorityRepository;
            }

            else return null;
        }
    }
}
